package service;

import java.util.*;

import beans.*;
import db.*;


public class doctorSchedulingService {
	
	public List<doctorSchedulingBean> browse(){
		doctorSchedulingDAO dao =new doctorSchedulingDAO();
		return dao.getAllRecords();
	}
	
	public boolean adddoctorScheduling(doctorSchedulingBean doctorScheduling)
	{
		doctorSchedulingDAO doctorSchedulingDao=new doctorSchedulingDAO();
		return doctorSchedulingDao.insertRecord(doctorScheduling);
	}
	
	public doctorSchedulingBean getRecord(int doctorSchedulingId)
	{
		doctorSchedulingDAO doctorSchedulingDao=new doctorSchedulingDAO();
		return doctorSchedulingDao.getRecord(doctorSchedulingId);
	}
	
	public int deldoctorScheduling(doctorSchedulingBean doctorScheduling)
	{
		doctorSchedulingDAO doctorSchedulingDao=new doctorSchedulingDAO();
		if(doctorSchedulingDao.deleteRecord(doctorScheduling))
			return 1;
		else
			return 2;
	}
	
	public int updatedoctorScheduling(doctorSchedulingBean beforeRecord,doctorSchedulingBean afterRecord)
	{
		doctorSchedulingDAO doctorSchedulingDao=new doctorSchedulingDAO();
		if(doctorSchedulingDao.updateRecord(beforeRecord,afterRecord))
			return 1;
		else
			return 2;
	}

	public List<doctorSchedulingBean> getdoctorSchedulingbymz(String mz) {
		doctorSchedulingDAO doctorSchedulingDao=new doctorSchedulingDAO();
		return doctorSchedulingDao.getdoctorSchedulingbymz(mz);
	}

	public List<doctorSchedulingBean> getdoctorSchedulingbyks(String ks) {
		doctorSchedulingDAO doctorSchedulingDao=new doctorSchedulingDAO();
		return doctorSchedulingDao.getdoctorSchedulingbyks(ks);
	}
}
